#include <iostream>
#include <vector>
using namespace std;
const int MAX = 1e6;
struct Edge {
  int v, w;
};

vector<Edge> e[MAX];

void dfs(int u, int fa) {
  for (auto ed : e[u]) {
    if (ed.v == fa)
      continue;
    cout << u << " " << ed.w << endl;
    dfs(ed.v, u);
  }
}

int main() { return 0; }